#ifndef BANK_AUTHMANAGER_HH
#define BANK_AUTHMANAGER_HH

#include "User.hh"
#include <memory>
#include <string>

class AuthManager {
private:
    const std::string SECRET_KEY = "000000"; // 秘钥，由728692修改为000000
    std::shared_ptr<User> currentUser;

public:
    AuthManager();

    // 用户认证方法
    bool authenticateAsCustomer(const std::string& username, const std::string& password);
    bool authenticateAsEmployee(const std::string& username, const std::string& secretKey);
    bool authenticateAsAdmin(const std::string& username, const std::string& secretKey);
    bool authenticateAsAuditor(const std::string& username, const std::string& secretKey);

    // 验证秘钥
    bool validateSecretKey(const std::string& inputKey) const;

    // 获取当前用户
    std::shared_ptr<User> getCurrentUser() const;
    Role getCurrentUserRole() const;
    bool isAuthenticated() const;
    
    // 登出
    void logout();
};

#endif // BANK_AUTHMANAGER_HH 